home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIProtocolHandler.idl < prev    next >
Text File  |  2006-05-08  |  7KB  |  168 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #include "nsISupports.idl"
  39.  
  40. interface nsIURI;
  41. interface nsIChannel;
  42.  
  43. /**
  44.  * nsIProtocolHandler
  45.  *
  46.  * @status FROZEN
  47.  */
  48. [scriptable, uuid(15fd6940-8ea7-11d3-93ad-00104ba0fd40)]
  49. interface nsIProtocolHandler : nsISupports
  50. {
  51.     /**
  52.      * The scheme of this protocol (e.g., "file").
  53.      */
  54.     readonly attribute ACString scheme;
  55.  
  56.     /** 
  57.      * The default port is the port that this protocol normally uses.
  58.      * If a port does not make sense for the protocol (e.g., "about:")
  59.      * then -1 will be returned.
  60.      */
  61.     readonly attribute long defaultPort;
  62.  
  63.     /**
  64.      * Returns the protocol specific flags (see flag definitions below).  
  65.      */
  66.     readonly attribute unsigned long protocolFlags;
  67.  
  68.     /**
  69.      * Makes a URI object that is suitable for loading by this protocol,
  70.      * where the URI string is given as an UTF-8 string.  The caller may
  71.      * provide the charset from which the URI string originated, so that
  72.      * the URI string can be translated back to that charset (if necessary)
  73.      * before communicating with, for example, the origin server of the URI
  74.      * string.  (Many servers do not support UTF-8 IRIs at the present time,
  75.      * so we must be careful about tracking the native charset of the origin
  76.      * server.)
  77.      *
  78.      * @param aSpec          - the URI string in UTF-8 encoding. depending
  79.      *                         on the protocol implementation, unicode character
  80.      *                         sequences may or may not be %xx escaped.
  81.      * @param aOriginCharset - the charset of the document from which this URI
  82.      *                         string originated.  this corresponds to the
  83.      *                         charset that should be used when communicating
  84.      *                         this URI to an origin server, for example.  if
  85.      *                         null, then UTF-8 encoding is assumed (i.e.,
  86.      *                         no charset transformation from aSpec).
  87.      * @param aBaseURI       - if null, aSpec must specify an absolute URI.
  88.      *                         otherwise, aSpec may be resolved relative
  89.      *                         to aBaseURI, depending on the protocol. 
  90.      *                         If the protocol has no concept of relative 
  91.      *                         URI aBaseURI will simply be ignored.
  92.      */
  93.     nsIURI newURI(in AUTF8String aSpec,
  94.                   in string aOriginCharset,
  95.                   in nsIURI aBaseURI);
  96.  
  97.     /**
  98.      * Constructs a new channel from the given URI for this protocol handler. 
  99.      */
  100.     nsIChannel newChannel(in nsIURI aURI);
  101.  
  102.     /**
  103.      * Allows a protocol to override blacklisted ports.
  104.      *
  105.      * This method will be called when there is an attempt to connect to a port 
  106.      * that is blacklisted.  For example, for most protocols, port 25 (Simple Mail
  107.      * Transfer) is banned.  When a URI containing this "known-to-do-bad-things" 
  108.      * port number is encountered, this function will be called to ask if the 
  109.      * protocol handler wants to override the ban.  
  110.      */
  111.     boolean allowPort(in long port, in string scheme);
  112.  
  113.  
  114.     /**************************************************************************
  115.      * Constants for the protocol flags (the first is the default mask, the
  116.      * others are deviations):
  117.      *
  118.      * NOTE: Implementation must ignore any flags they do not understand.
  119.      */
  120.  
  121.     /**
  122.      * standard full URI with authority component and concept of relative
  123.      * URIs (http, ftp, ...)
  124.      */
  125.     const unsigned long URI_STD = 0;
  126.  
  127.     /**
  128.      * no concept of relative URIs (about, javascript, finger, ...)
  129.      */
  130.     const unsigned long URI_NORELATIVE = (1<<0);
  131.  
  132.     /**
  133.      * no authority component (file, ...)
  134.      */
  135.     const unsigned long URI_NOAUTH = (1<<1);
  136.  
  137.     /**
  138.      * This protocol handler can be proxied via a proxy (socks or http)
  139.      * (e.g., irc, smtp, http, etc.).  If the protocol supports transparent
  140.      * proxying, the handler should implement nsIProxiedProtocolHandler.
  141.      *
  142.      * If it supports only HTTP proxying, then it need not support
  143.      * nsIProxiedProtocolHandler, but should instead set the ALLOWS_PROXY_HTTP
  144.      * flag (see below).
  145.      *
  146.      * @see nsIProxiedProtocolHandler
  147.      */
  148.     const unsigned long ALLOWS_PROXY = (1<<2);
  149.  
  150.     /**
  151.      * This protocol handler can be proxied using a http proxy (e.g., http,
  152.      * ftp, etc.).  nsIIOService::newChannelFromURI will feed URIs from this
  153.      * protocol handler to the HTTP protocol handler instead.  This flag is
  154.      * ignored if ALLOWS_PROXY is not set.
  155.      */
  156.     const unsigned long ALLOWS_PROXY_HTTP = (1<<3);
  157. };
  158.  
  159. %{C++
  160. /**
  161.  * Protocol handlers are registered with XPCOM under the following CONTRACTID prefix:
  162.  */
  163. #define NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "@mozilla.org/network/protocol;1?name="
  164. /**
  165.  * For example, "@mozilla.org/network/protocol;1?name=http"
  166.  */
  167. %}
  168.